<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    var num = prompt("请输入一个三位数数字");
    var a = num % 10;
    var b = parseInt((num % 100) / 10);
    var c = parseInt(num / 100);
    var sum = a + b + c;
    alert("你输入的三位数数字是" + num + ",位数相加得"+sum);
  </script>
</head>
<body>
  
  
</body>
</html>